{load href="__module__/admin/role/auth.css" /}
<form class="layui-form">
    {foreach $menulist as $menu}
    <div class="layui-row">
        {if in_array($menu['id'],$auth)}
        <input checked="checked" class="menu" lay-filter="menu" lay-id="{$menu['id']}" lay-skin="primary" title="{$menu['name']}" type="checkbox" value="1"/>
        {else}
        <input class="menu" lay-filter="menu" lay-id="{$menu['id']}" lay-skin="primary" title="{$menu['name']}" type="checkbox" value="0"/>
        {/if}
    </div>
    {if !$menu['route'] && isset($menu['sub'])}
    <div class="layui-row layui-menu-sub">
        {foreach $menu['sub'] as $sub}
        {if in_array($sub['id'],$auth)}
        <input checked="" class="sub" lay-filter="sub" lay-id="{$sub['id']}" lay-skin="primary" title="{$sub['name']}" type="checkbox" value="1"/>
        {else}
        <input class="sub" lay-filter="sub" lay-id="{$sub['id']}" lay-skin="primary" title="{$sub['name']}" type="checkbox" value="0"/>
        {/if}
        {/foreach}
    </div>
    {/if}
    {/foreach}
    <div class="layui-row layui-menu-sub">
        <button class="layui-btn" lay-filter="authform" lay-submit="">
            保存
        </button>
        <button class="layui-btn layui-btn-primary layui-btn-cancel" type="button">
            取消
        </button>
    </div>
</form>
<input id="id" type="hidden" value="{$id}"/>
<input id="auth" type="hidden" value="{:implode(',', $auth)}"/>
{load href="__module__/admin/role/auth.js" /}
